package com.example.demo.controller.front;

import com.example.demo.dao.HuiFu;
import com.example.demo.service.HuiFuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Controller
@RequestMapping("/reply")
public class ReplyController {
    @Autowired
    private HuiFuService huiFuService;
    //获得回复者的Id 再进行回复
    @RequestMapping("/get")
    public String getid(@RequestParam("id") Integer id  ,Model model){
        model.addAttribute("id",id);
        return "reply";
    }

    //添加回复
    @PostMapping("/addreply")
    public String addreply(HuiFu huiFu){
        int update = huiFuService.addhuifu(huiFu);
        return "redirect:/comment/find";
    }

}
